﻿#ifndef MERGEDIALOG_H
#define MERGEDIALOG_H

#include <QDialog>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QGraphicsItem>

#include "textsettingdlg.h"

class TextSettingDlg;
class QGraphicsLineItem;

namespace Ui {
class MergeDialog;
}

class MergeDialog : public QDialog
{
    Q_OBJECT

public:
    explicit MergeDialog(QWidget *parent = 0);
    ~MergeDialog();

    void setImage(const QImage& img);

    void setInfoTip();

    void original();

    void configTextItem(CBType hType, QPoint pos, CBType vType, QGraphicsTextItem* txtItem);
    
    void image2PDF(const QImage& img,QString pdfPath);

    QImage render();

protected:
    void keyPressEvent(QKeyEvent* event);

private slots:
    void on_pb_select_clicked();

    void on_pb_line_clicked();

    void on_pb_rect_clicked();

    void on_pb_round_clicked();

    void on_pb_text_clicked();

    void on_spinBox_valueChanged(int arg1);

    void on_pb_color_clicked();

    void on_pb_origin_clicked();

    void on_pb_arrow_clicked();

    void on_pb_arrow2_clicked();

    void on_pb_draw_clicked();

    void on_pb_save_clicked();

    void on_pb_export_clicked();

    void on_pb_undo_clicked();

private:
    Ui::MergeDialog *ui = nullptr;
    QGraphicsScene* m_scene = nullptr;
    QGraphicsPixmapItem* m_item = nullptr;
    TextSettingDlg* m_textSettingDlg = nullptr;
    QGraphicsLineItem* m_centerLine = nullptr;
    QSize m_size;
    QImage m_image;
};

#endif // MERGEDIALOG_H
